﻿<?php

$obj=new mysql($config);

if(!empty($_POST)){    
    $arr=array();
    $id=$_POST['id'];
    $arr['name']=$_POST['name'];
    $arr['author_id']=implode(',',$_POST['author_id']);

    $row=$obj->update($arr,array('id'=>$id),'role');
    if($row>0){
         echo "<script>alert('更新成功');location.href='index.php?c=role&a=list&mod=admin';</script>";
    }else{
         echo "<script>alert('更新失败');history.go(-1);</script>";
    }
}




    $id=$_GET['id'];
    $sql="select * from `role` where id=$id";
    $one=$obj->getOne($sql);

    $sql="select * from `author` where pid=0";
    $date=$obj->getCondition($sql);

    foreach ($date as $k => $v) {
        $sql="select * from `author` where `pid`=$v[id]";
        $date[$k]['ch']=$obj->getCondition($sql);
    }









require_once (VIEW_PATH.'admin/layout.html');

